package org.company.earth.socket;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.InetAddress;
import java.net.Socket;

public class MyClientSocket {
	
	public void startup() throws IOException {
		Socket client = new Socket(InetAddress.getLocalHost(),8989);
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String buffer = null;
		while((buffer = in.readLine()) != null) {
			out.write(buffer);
			out.flush();
			if("shutdown".equalsIgnoreCase(buffer)) {
				break;
			}
		}
		out.close();
		client.close();
	}
}
